<div class="modal-header">
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  <h3>Last Elasticsearch Query</h3>
</div>
<div class="modal-body">

  <div>
    <pre>curl -XGET '{{config.elasticsearch}}/{{dashboard.indices|stringify}}/_search?pretty' -d '{{inspector}}'
    </pre>
  </div>
  
</div>
<div class="modal-footer">
  <button type="button" class="btn btn-success" ng-click="dismiss()" onclick="
	var el=JSON.parse( localStorage.getItem('editor_state') );
	if (el.content){
	var time = new Date().getTime();
	el.time = time;
	localStorage.setItem('hist_elem_'+time,JSON.stringify(el));
	el.content='GET _search \n'+JSON.stringify({{inspector}});
	localStorage.setItem('editor_state',JSON.stringify(el));
	window.open('./sense');
	} else { alert('Please configure url+auth in Sense before using'); }
  ">Open in Sense</button>
  <button type="button" class="btn btn-success" ng-click="dismiss()">Close</button>
</div>
